package com.cqut.service.impl;

import java.util.List;
import java.util.Map;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.cqut.dao.CompetitionAuditMapper;
import com.cqut.dao.CompetitionAuditMapperExtra;
import com.cqut.dto.LimitShowDTO;
import com.cqut.service.ICompetitionAuditService;

@Service
public class CompetitionAuditService implements ICompetitionAuditService{
@Resource(name = "competitionAuditMapper")
private CompetitionAuditMapper competitionAuditMapper;
@Resource(name = "competitionAuditMapperExtra")
private CompetitionAuditMapperExtra competitionAuditMapperExtra;

	@Override
	public boolean passCompetitionAudits(String[] competitionsIds) {
		// TODO Auto-generated method stub
		return (competitionAuditMapperExtra.passCompetitions(competitionsIds)>0);
	}

	@Override
	public Map<String, Object> competitionAuditDetail(String competitionId) {
		// TODO Auto-generated method stub
		return null;
	}
/*
	@Override
	public long findCountOfCompetitionAudits(String judgeName, String subordinate_units) {
		// TODO Auto-generated method stub
		return 0;
	}*/


	@Override
	public long findCountOfCompetitionAudits(String competitionName, String competitionState) {
		// TODO Auto-generated method stub
		long count = competitionAuditMapperExtra.findCountByLimit(competitionName,competitionState);
		return count;
	}


	@Override
	public List<Map<String, Object>> findCompetitionAuditsWithLimit(String competitionName,String competitionState, LimitShowDTO limitShowDTO) {
		// TODO Auto-generated method stub
		
		return competitionAuditMapperExtra.findCompetitionAuditsByLimit(competitionName, competitionState,limitShowDTO.calculateStart(),limitShowDTO.calculateEnd());
	}


	@Override
	public boolean retreatCompetitionAudits(String[] competitionsIds) {
		// TODO Auto-generated method stub
		return (competitionAuditMapperExtra.retreatCompetitions(competitionsIds)>0);
	}


	@Override
	public Map<String, Object> getCompetitionDetailById(String competitionId) {
		// TODO Auto-generated method stub
		return competitionAuditMapperExtra.getDetailById(competitionId);
	}


	@Override
	public List<Map<String, Object>> getState() {
		// TODO Auto-generated method stub
		return competitionAuditMapperExtra.getStates();
	}


	@Override
	public List<Map<String, Object>> findCompetitionList(String competitionName, String competitionState,
			String subordinate_units, LimitShowDTO limitShowDTO) {
		// TODO Auto-generated method stub
		return null;
	}

}
